package com.project.controller;

import com.project.entity.po.Entry;
import com.project.result.ResponseResult;
import com.project.service.EntryService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping("/entry")
public class EntryController {
    @Resource
    EntryService entryService;


    @GetMapping("/select/all/entry")
    public ResponseResult<List<Entry>> selectAllEntry(){
        return entryService.selectAllEntry();
    }

    @GetMapping("/select/entry/name")
    public ResponseResult<List<Entry>> selectEntryByName(String name){
        return entryService.selectEntryByName(name);
    }

    @PostMapping("/update/entry")
    public ResponseResult<Integer> updateEntry(Entry entry){
        return entryService.updateEntry(entry);
    }

    @PostMapping("/update/entry/id")
    public ResponseResult<Integer> updateEntryById(Long id){
        return entryService.updateEntryById(id);
    }

    @PutMapping("/insert/entry")
    public ResponseResult<Integer> insertEntry(Entry entry){
        return entryService.insertEntry(entry);
    }

}
